import axios from 'axios'

const service = axios.create({
  baseURL: 'http://127.0.0.1:5000/api/',
  timeout: 5000
})

service.interceptors.response.use(
  (response) => {
    const { status, data } = response
    if (status.toString().includes('2')) {
      return data
    } else {
      console.error('error')
    }
  }, (error) => {
    console.error(error)
  }
)

export default service
